/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
package robocup.component.speechacts.coachlanguage;

public class Point {

	private TypeConstants.POINTTYPE pointType = TypeConstants.POINTTYPE.INIT;

	private double x = 0;

	private double y = 0;

	private boolean teamOur = false;

	private boolean ball = false;

	private int unumInt = 0;

	private String unumString = "";

	private Point point = null;

	private PointArith pointArith = null;

	public PointArith getPointArith() {
		return pointArith;
	}

	public void setPointArith(PointArith pointArith) {
		this.pointArith = pointArith;
	}

	public int getUnumInt() {
		return unumInt;
	}

	public void setUnumInt(int unumInt) {
		this.unumInt = unumInt;
	}

	public String getUnumString() {
		return unumString;
	}

	public void setUnumString(String unumString) {
		this.unumString = unumString;
	}

	public boolean isTeamOur() {
		return teamOur;
	}

	public void setTeamOur(boolean teamOur) {
		this.teamOur = teamOur;
	}

	public boolean isBall() {
		return ball;
	}

	public void setBall(boolean ball) {
		this.ball = ball;
	}

	public double getX() {
		return x;
	}

	public void setX(double x) {
		this.x = x;
	}

	public double getY() {
		return y;
	}

	public void setY(double y) {
		this.y = y;
	}

	public TypeConstants.POINTTYPE getPointType() {
		return pointType;
	}

	public void setPointType(TypeConstants.POINTTYPE pointType) {
		this.pointType = pointType;
	}

	public Point getPoint() {
		return point;
	}

	public void setPoint(Point point) {
		this.point = point;
	}

	public String toString() {
		StringBuffer buf = new StringBuffer();

		switch (this.pointType) {

		case INIT:
			buf.append("(empty point)");
			break;

		case BALL:
			buf.append("(pt ball)");
			break;

		case XY:
			buf.append("(pt " + this.x + " " + this.y + ")");
			break;

		case XY_POINT:
			buf.append("(pt " + this.x + " " + this.y + " "
					+ this.point.toString() + ")");
			break;

		case UNUM:
			String str = "";
			if (this.teamOur)
				str = "our";
			else
				str = "opp";
			String unum = "";
			if (this.unumString.matches(""))
				unum = " " + this.unumInt;
			else
				unum = " " + this.unumString;

			buf.append("(pt " + str + unum + ")");
			break;

		case POINT_ARITH:
			buf.append("(" + this.pointArith.toString() + ")");
			break;
		}

		return buf.toString();
	}

}
